﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class Admin_user_ViewUserList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[CE.Global.General.UserId] != null && Session[CE.Global.General.UserTypeId] != null)
        {
            if (Convert.ToInt32(Session[CE.Global.General.UserTypeId]) !=
                Convert.ToInt32(CE.Global.CEUserType.SiteAdmin))
            {
                Response.Redirect("~/Admin/AdminSecureLogin.aspx");
            }
        }
        else
        {
            Response.Redirect("~/Admin/AdminSecureLogin.aspx");
        }

    }
    protected void btnShowResult_Click(object sender, EventArgs e)
    {

    }

    protected void grvUser_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string _surname = DataBinder.Eval(e.Row.DataItem, "SurName").ToString();
            Label lblSurName = (Label)e.Row.FindControl("lblSurName");
            lblSurName.Text = CE.Security.MySecurity.Decrypt(_surname, true);

            string _email = DataBinder.Eval(e.Row.DataItem, "Email").ToString();
            Label lblEmail = (Label)e.Row.FindControl("lblEmail");
            lblEmail.Text = CE.Security.MySecurity.Decrypt(_email, true);

        }
    }
    protected void grvUser_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (grvUser.Rows.Count > 0)
        {
            //string dtNow = CE.Global.General.GetUTCDateTime().Year.ToString("0000") + CE.Global.General.GetUTCDateTime().Month.ToString("00") + CE.Global.General.GetUTCDateTime().Day.ToString("00");
            string dtNow = CE.Global.General.GetUTCDateTime().Year.ToString("0000") + CE.Global.General.GetUTCDateTime().Month.ToString("00") + CE.Global.General.GetUTCDateTime().Day.ToString("00");
            if (ddlSelecteToView.Text == "100")
            {
                Response.Redirect("ViewLoginHistory.aspx?CEID=" + grvUser.SelectedDataKey.Value.ToString() + "&dt=" + dtNow);
            }
        }
    }
}
